import Mock from 'mockjs2'
import {builder, getQueryParameters} from "@/mock/util";


const tagList = (options) => {
	console.log(' mock: user tag list')
	console.log(options)
	const data = [
		{
			"id": 1,
			"projectId": "2d3f59f847f44745b9636a8f4fdd4582",
			"orgId": 1,
			"name": "user_tag_memberLevel",
			"displayName": "会员等级",
			"tagCategory": {
				"id": 2,
				"name": "会员信息",
				"parent": 0,
				"remark":""
			},
			"type": 0,
			"dataType": 0,
			"updateType": 0,
			"remark":"123123123123123123132123123123123123123123123123123123123",
			"creatorName": "admin",
			"createdAt": "2022-08-25 00:00:00",
			"updatedAt": "2022-08-25 00:00:00"
		},
		{
			"id": 2,
			"projectId": "2d3f59f847f44745b9636a8f4fdd4582",
			"orgId": 1,
			"name": "user_tag_high_level_user",
			"displayName": "高价值用户",
			"tagCategory": {
				"id": 3,
				"name": "用户信息",
				"parent": 0,
				"remark":""
			},
			"type": 0,
			"dataType": 0,
			"updateType": 0,
			"creatorName": "admin",
			"createdAt": "2022-08-25 00:00:00",
			"updatedAt": "2022-08-25 00:00:00"
		},
		{
			"id": 3,
			"projectId": "2d3f59f847f44745b9636a8f4fdd4582",
			"orgId": 1,
			"name": "user_tag_15_days_visitor",
			"displayName": "近15天活跃用户",
			"tagCategory": {
				"id": 3,
				"name": "用户信息",
				"parent": 0,
				"remark":""
			},
			"type": 0,
			"dataType": 0,
			"updateType": 0,
			"creatorName": "admin",
			"createdAt": "2022-08-25 00:00:00",
			"updatedAt": "2022-08-25 00:00:00"
		}


	]
	return builder(data)
}



const tagTaskList = (options) => {
	console.log(' mock: user tag task list')
	console.log(options)
	const data = [
		{
			"userTagName": "user_tag_memberLevel",
			"status": 0,
			"updatedAt": "2022-08-26 16:01:59",
			"users": 1000000
		},
		{
			"userTagName": "user_tag_high_level_user",
			"status": 0,
			"updatedAt": "2022-08-26 16:11:59",
			"users": 500
		},{
			"userTagName": "user_tag_15_days_visitor",
			"status": 0,
			"updatedAt": "2022-08-26 16:30:58",
			"users": 10
		},

	]
	return builder(data)
}

const tagDetail = (options) => {
	console.log(' mock: tag detail')
	console.log(options)
	const data = {
		totalUsers: 35304,
		baseTime: "2022-08-25 00:00:00",
		finishAt: "2022-08-25 00:00:05",
		"tagValueStats": [
			{
				"value": "青铜",
				"users": 30002
			},
			{
				"value": "白银",
				"users": 3302
			},
			{
				"value": "黄金",
				"users": 2000
			}
		]
	}
	return builder(data)
}

Mock.mock(/^.*?\/smartreportservice\/usertag\?.*?/, 'get', tagList)
Mock.mock(/^.*?\/smartreportservice\/usertag\/task\/last[^\/]*?/, 'get', tagTaskList)
Mock.mock(/^.*?\/smartreportservice\/usertag\/[0-9]+.*?/, 'get', tagDetail)
